//
//  SummaryDataModel.swift
//  TimeBoat
//
//  Created by bo wang on 2022/8/24.
//  Copyright © 2022 Time Boat. All rights reserved.
//

import Foundation
import YYModel

@objc class SummaryNormalData: NSObject, YYModel {
    @objc var bloodOxygen: Int = 0
    @objc var bodyTemperature: Double = 0
    @objc var heartRate: Int = 0
    @objc var deviceTime: String?
    
    lazy var date: Date? = {
        guard let str = deviceTime else { return nil }
        return dateFromServerDateStr(str)
    }()
}

@objc class SummarySleepData: NSObject, YYModel {
    @objc var totalDeepSleepMinute: Double = 0
    @objc var totalLightSleepMinute: Double = 0
    @objc var totalMinute: Double = 0
    @objc var totalSoberMinute: Double = 0
}

@objc class SummaryStepsData: NSObject, YYModel {
    @objc var calorie: Double = 0
    @objc var deviceTime: String?
    @objc var distance: Double = 0
    @objc var stepCount: Int = 0
}

@objc class SummarySportDayInfo: NSObject, YYModel {
    @objc var calorie: Double = 0
    @objc var useTime: Double = 0
}

@objc class SummarySportWeekInfo: NSObject, YYModel {
    @objc var dayList: [SummarySportDayInfo] = []
    @objc var totalCalorie: Int = 0
    @objc var totalTime: Int = 0
    
    @objc static func modelContainerPropertyGenericClass() -> [String: Any]? {[
        "dayList": SummarySportDayInfo.self
    ]}
}

@objc class SummaryDataModel: NSObject, YYModel {
    @objc var bloodOxygen: SummaryNormalData?
    @objc var bodyTemperature: SummaryNormalData?
    @objc var heartRate: SummaryNormalData?
    @objc var sleepMonitorState: SummarySleepData?
    @objc var totalStep: SummaryStepsData?
    @objc var weekSportInfo: SummarySportWeekInfo?
}
